(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
  ["pages/user/auth/perfect"], {
    "0753": function (t, e, n) {
      "use strict";
      n.r(e);
      var r = n("f826"),
        i = n.n(r);
      for (var o in r) "default" !== o && function (t) {
        n.d(e, t, (function () {
          return r[t]
        }))
      }(o);
      e["default"] = i.a
    },
    1316: function (t, e, n) {
      "use strict";
      (function (t) {
        n("77a0");
        r(n("66fd"));
        var e = r(n("fedc"));

        function r(t) {
          return t && t.__esModule ? t : {
            default: t
          }
        }
        t(e.default)
      }).call(this, n("543d")["createPage"])
    },
    e734: function (t, e, n) {
      "use strict";
      n.d(e, "b", (function () {
        return i
      })), n.d(e, "c", (function () {
        return o
      })), n.d(e, "a", (function () {
        return r
      }));
      var r = {
          uniPopup: function () {
            return n.e("components/uni-popup/uni-popup").then(n.bind(null, "e0c0"))
          }
        },
        i = function () {
          var t = this,
            e = t.$createElement,
            n = (t._self._c, t.$wanlshop.oss(t.userInfo.avatarUrl, 50, 50)),
            r = t.$wanlshop.appstc("http://yimei111.oss-cn-beijing.aliyuncs.com/uploads/20201207/633e2a378a472c45e637e9e33eb1176e.png");
          t.$mp.data = Object.assign({}, {
            $root: {
              g0: n,
              g1: r
            }
          })
        },
        o = []
    },
    ec1c: function (t, e, n) {},
    f826: function (t, e, n) {
      "use strict";
      (function (t) {
        Object.defineProperty(e, "__esModule", {
          value: !0
        }), e.default = void 0;
        var r = i(n("565b"));

        function i(t) {
          return t && t.__esModule ? t : {
            default: t
          }
        }
        var o = {
          data: function () {
            return {
              userInfo: {
                avatarUrl: "",
                nickName: null,
                gender: 0
              },
              pageroute: "",
              provider: null,
              timer: null,
              third_id: 0,
              phone:'',
              hasUserInfo:''
            }
          },
          onLoad: function (t) {
            var e = this;
            this.pageroute = t.url, this.third_id = t.third_id, "mp_weixin" == t.platform || "app_weixin" == t.platform ? this.provider = "weixin" : "mp_qq" == t.platform || "app_qq" == t.platform ? this.provider = "qq" : "app_weibo" == t.platform ? this.provider = "sinaweibo" : "app_xiaomi" == t.platform ? this.provider = "xiaomi" : "apple" == t.platform && (this.provider = "apple"),
             this.setUserInfo(),
              setTimeout((function () {
              e.userInfo.nickName || e.$refs.authPopup.open()
            }), 100)
          },
          onUnload: function () {
            this.timer && (clearInterval(this.timer), this.timer = null)
          },
          methods: {
            decryptPhoneNumber: function (e) {
              var that = this
              if (e.detail.errMsg == 'getPhoneNumber:fail user deny') {
                wx.showModal({
                  title: '提示',
                  showCancel: false,
                  content: '未授权',
                  success: function (res) { }
                })
              } else {
                wx.login({
                  success: function (res) {
                    var code = res.code;
                    if (res.code) {
                      //发起网络请求

                    } else {
                      console.log('获取用户登录态失败！' + res.errMsg)
                    }
                    wx.request({
                      url: 'https://www.xiaoyudiyimei.cn/api/wanlshop/user/phone2',
                      data: {
                        code: code,
                        iv: e.detail.iv,
                        encryptedData: e.detail.encryptedData
                      },
                      method: 'GET',
                      header: {
                        'content-type': 'application/json'
                      },
                      success: function (res) {

                          that.phone = res.data.data
                      },
                    });
                  }
                });
              }
        },

        getUserProfile(e) {
          var that = this
          wx.getUserProfile({
            desc: '用于完善会员资料',
            success: (res) => {
              that.userInfo = res.userInfo
              that.hasUserInfo = true
              that.getUserInfo()
            }
          })
        },


            getUserInfo: function () {
              var e = this;
              //判断这个账号有无注册过
              wx.request({
                url: 'https://www.xiaoyudiyimei.cn/api/index/ifuser',
                data: {
                  openid: wx.getStorageSync("openid")
                },
                success:function(res){

                  if(res.data.data == 'no'){

                       t.showLoading({
                      title: "拉取授权中.."
                    }), e.$refs.authPopup.close(), e.timer ? clearInterval(e.timer) : e.timer = setInterval((function () {

                      e.setUserInfo2()
                    }), 1e3)
                  }else{

                      e.formSubmit2()

                  }
                }
              })
            },
            refuseUserInfo: function () {
                 wx.reLaunch({
                    url: '/pages/user/user',
                  })
            },

            setUserInfo: function () {

              var e = this;
              t.getUserInfo({
                provider: this.provider,
                success: function (n) {
                   e.userInfo = n.userInfo, t.hideLoading()
                }
              }), this.userInfo.nickName && this.timer && (clearInterval(this.timer), this.timer = null)
            },

            setUserInfo2: function () {

              var e = this;
              t.getUserInfo({
                provider: this.provider,
                success: function (n) {
                  //  e.userInfo = n.userInfo,
                   t.hideLoading()
                }
              }), this.userInfo.nickName && this.timer && (clearInterval(this.timer), this.timer = null)
            },



            formSubmit2: function (e) {

              var n= this
             this.$api.post({
                url: "/wanlshop/user/perfect2",
                data: {
                  openid:wx.getStorageSync("openid"),
                },
                success: function (e) {

                  n.$store.dispatch("user/login", e),
                  n.$store.dispatch("cart/login")
                  n.$store.dispatch("chat/get")
                   t.reLaunch({
                    url: decodeURIComponent(n.pageroute)
                  })

                  wx.reLaunch({
                    url: '/pages/wanlshop/index',
                  })
                }
              })
            },
            　

            formSubmit: function (e) {

              if(wx.getStorageSync("qudao")){
                var qudao = wx.getStorageSync("qudao")
              }else{
                var qudao = 0
              }
                if(!this.phone){
                  this.$wanlshop.msg("请先获取手机号")
                  return false
                }
              var n = this,
                i = [{
                  name: "nickName",
                  checkType: "string",
                  checkRule: "1,20",
                  errorMsg: "用户名应该1-10字符之间"
                }],
                o = e.detail.value,
                a = r.default.check(o, i);
              a ? this.$api.post({
                url: "/wanlshop/user/perfect",
                data: {
                  // third_id: this.third_id,
                  openid:wx.getStorageSync("openid"),
                  third_id: 0,
                  avatarUrl: this.userInfo.avatarUrl,
                  nickName: this.userInfo.nickName,
                  gender: this.userInfo.gender,
                  phone:this.phone,
                  qudao:qudao

                },
                success: function (e) {

                  n.$store.dispatch("user/login", e),
                  n.$store.dispatch("cart/login"),
                  n.$store.dispatch("chat/get"),
                   t.reLaunch({
                    url: decodeURIComponent(n.pageroute)
                  })

                  wx.reLaunch({
                    url: '/pages/wanlshop/index',
                  })
                }
              }) : this.$wanlshop.msg("请填写用户名")
            }


          }
        };
        e.default = o
      }).call(this, n("543d")["default"])
    },
    fea0: function (t, e, n) {
      "use strict";
      var r = n("ec1c"),
        i = n.n(r);
      i.a
    },
    fedc: function (t, e, n) {
      "use strict";
      n.r(e);
      var r = n("e734"),
        i = n("0753");
      for (var o in i) "default" !== o && function (t) {
        n.d(e, t, (function () {
          return i[t]
        }))
      }(o);
      n("fea0");
      var a, s = n("f0c5"),
        u = Object(s["a"])(i["default"], r["b"], r["c"], !1, null, null, null, !1, r["a"], a);
      e["default"] = u.exports
    }
  },
  [
    ["1316", "common/runtime", "common/vendor"]
  ]
]);
